package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum AuditStatus {
	AUDIT(0,"待审核"),
	AUDITFAIL(1,"审核失败"),
	AUDITSUCCESS(2,"审核成功");
	
	private Integer status;
	
	private String value;

	private AuditStatus(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static AuditStatus toFlag(int status) {
		if (AUDIT.status == status) {
			return AUDIT;
		} else if (AUDITFAIL.status == status) {
			return AUDITFAIL;
		} else if (AUDITSUCCESS.status == status) {
			return AUDITSUCCESS;
		} else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
